package com.example.administrator.printoutindemo.mvp.ui.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.administrator.printoutindemo.R;

import java.util.List;


public class MeterSearchConditionAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    private Context mContext;
    private IMeterSearchConditionAdapter mIMeterSearchConditionAdapter;

    public MeterSearchConditionAdapter(Context context, @Nullable List<String> data, IMeterSearchConditionAdapter iMeterSearchConditionAdapter) {
        super(R.layout.item_meter_search_condition, data);
        this.mContext = context;
        this.mIMeterSearchConditionAdapter = iMeterSearchConditionAdapter;
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.setText(R.id.tv_title, item);
        helper.setOnClickListener(R.id.img_del, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mIMeterSearchConditionAdapter.delMeterSearchCondition(item);
            }
        });
    }

    public interface IMeterSearchConditionAdapter {
        void delMeterSearchCondition(String item);
    }

}
